let secs = document.querySelector("section ul")
const xhr1 = new XMLHttpRequest()
xhr1.open("get","http://chst.vip:1234/api/getmoneyctrl")
xhr1.onload = function(){
    if(xhr1.status === 200){
        let res1 = JSON.parse(xhr1.responseText)
        console.log(res1.result)
        let lis =''
        let regExp = /^<[^<]+\s+src="([^''""]*)"/
        res1.result.forEach((item,index) => {
            let url = res1.result[index].productImgSm.match(regExp)[1].split('=')[2];
            lis +=
            `
            <li>
                <a productid=${item.productId} >
             
                    <div>
                        <img src="${url}" alt="">
                    </div>



                    <div class="ycsj">
                        <div>
                            <h4>${item.productName}</h4>
                        </div>

                        <div class="ycpl">
                            <span>${item.productFrom}${item.productTime}</span>
                            <i></i>
                            <span>${item.productComCount}</span>
                        </div>
                    </div>
                  
                </a>
            </li>
            `
            
        })
        secs.innerHTML = lis


    }
}
xhr1.send(null)
$('ul').on('click','li',function(){
    let productid = $(this).find('a').attr('productid')
    console.log(productid)
    location.href = `./page2-1.html?productid=${productid}`
})